<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

// Load drawer
require_once 'Drawer.php';

// Load image
require_once 'image/Image.php';
require_once 'image/JpgImage.php';

// Load filters
require_once 'filters/Filter.php';
require_once 'filters/RectangleFilter.php';
require_once 'filters/FilledRectangleFilter.php';

// Load exceptions
require_once 'exceptions/ImageCreateException.php';
require_once 'exceptions/FilterDrawException.php';
require_once 'exceptions/ColorAllocationException.php';

// Load others
require_once 'Point.php';
require_once 'Color.php';

// Create an Image of size 120x90 with background color white
$oImage = new JpgImage(120, 90);
new Color($oImage, 255, 255, 255);

// Create an yellow rectangle with a blue line
$oX = new Point(0, 0);
$oY = new Point(119, 89);
$oLine = new RectangleFilter(null, $oX, $oY, new Color($oImage, 0, 0, 255));
$oFill = new FilledRectangleFilter($oLine, $oX, $oY, new Color($oImage, 255, 255, 0));

// Create the drawer
$oDrawer = new Drawer($oImage, $oFill);

// Draw the image
$oImage->header();
print $oDrawer->draw();
